package com.zhiwang.planet.ui.webview_ultimate.interceptors

import android.util.Log
import android.webkit.ConsoleMessage
import android.webkit.WebView
import com.zhiwang.planet.BuildConfig
import com.zhiwang.planet.ui.webview_ultimate.InterceptorAdapter

class ConsoleInterceptor: InterceptorAdapter() {

    private  val TAG = "ConsoleInterceptor"

    override fun onConsoleMessage(webView: WebView,consoleMessage: ConsoleMessage): Boolean {

        if (BuildConfig.DEBUG)
            Log.i(TAG, "onConsoleMessage: ${consoleMessage.message()}  " +
                    "${webView.settings?.userAgentString}  " +
                    "${consoleMessage.lineNumber()}")
        return true
    }


}